<h1><?php echo $grocery_list_name; ?></h1>
<?php $completeprice = 0; ?>
<div class="entry">
	<table class="grocerylist" id="grocerylisttable">
	<tr><th>Naam</th><th>Aantal</th><th>Product prijs</th><th>Totaal prijs</th></tr>
	<?php if(!empty($products)) : ?> 
		<?php foreach($products as $product) : ?>
				<tr id="tr<?php echo $product['id']; ?>">
					<td><?php echo $product['name']; ?></td>
					<td><input class="amount-<?php echo $product['id']; ?>" type="text" value="<?php echo $product['amount']; ?>" /></td>
					<td class="price-<?php echo $product['id']; ?>"><?php echo $product['price']; ?></td>
					<td class="total-<?php echo $product['id']; ?>"><?php echo $total = number_format($product['price'] * floatval($product['amount']), 2); ?></td>
					<td><button class="change" id="<?php echo $product['id']; ?>">Wijzig</button></td>
					<td><button class="delete" id="<?php echo $product['id']; ?>">Verwijder</button></td>
					<td class="redalert"><div class="alert-<?php echo $product['id']; ?>"></div></td>
				</tr>
				<?php $completeprice += $total; ?>
		<?php endforeach;?>
	<?php endif;?>	
	<tr><td></td><td></td><th>Totaal:</th><th><div class="totalprice"><?php echo $completeprice;?></div></th></tr>
	</table>
	
</div>